package com.buer.train.business.service.impl;

import com.buer.train.business.dao.RoleMenuDao;
import com.buer.train.business.domain.RoleMenuDO;
import com.buer.train.business.service.RoleMenuService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;



@Service
public class RoleMenuServiceImpl implements RoleMenuService {
	@Autowired
	private RoleMenuDao roleMenuDao;
	
	@Override
	public RoleMenuDO get(Integer id){
		return roleMenuDao.get(id);
	}
	
	@Override
	public List<RoleMenuDO> list(Map<String, Object> map){
		return roleMenuDao.list(map);
	}
	
	@Override
	public int count(Map<String, Object> map){
		return roleMenuDao.count(map);
	}
	
	@Override
	public int save(RoleMenuDO roleMenu){
		return roleMenuDao.save(roleMenu);
	}
	
	@Override
	public int update(RoleMenuDO roleMenu){
		return roleMenuDao.update(roleMenu);
	}
	
	@Override
	public int remove(Integer id){
		return roleMenuDao.remove(id);
	}
	
	@Override
	public int batchRemove(Integer[] ids){
		return roleMenuDao.batchRemove(ids);
	}

    @Override
    public PageInfo<RoleMenuDO> getRoleMenuList(Map<String, Object> map) {
        PageHelper.startPage(map); //开始起始页
        List<RoleMenuDO> list = roleMenuDao.getRoleMenuList(map); // 获取数据
        PageInfo<RoleMenuDO> page = new PageInfo<>(list); // 实例化PageInfo
        return page;
    }

    @Override
    public RoleMenuDO getOne(Map<String, Object> map){
        return roleMenuDao.getOne(map);
    }

	@Override
	public int removeByRoleId(Integer roleId) {
		return roleMenuDao.removeByRoleId(roleId);
	}

}
